/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="account")
public class Account implements Serializable {
	public Account() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Member member;
	
	private Integer purse;
	
	private Integer commissions;
	
	private Integer points;
	
	private Byte state;
	
	private String paypwd;
	
	private String key1;
	
	private String key2;
	
	private Byte isLocked;
	
	private String verify;
	
	@Version	
	private Integer version;
	
	private java.util.Set fundFlow = new java.util.HashSet();
	
	private java.util.Set commission = new java.util.HashSet();
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_ACCOUNT_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_ACCOUNT_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	/**
	 * 钱包
	 */
	public void setPurse(int value) {
		setPurse(new Integer(value));
	}
	
	/**
	 * 钱包
	 */
	public void setPurse(Integer value) {
		this.purse = value;
	}
	
	/**
	 * 钱包
	 */
	@Column(name="purse", nullable=true, length=10)	
	public Integer getPurse() {
		return purse;
	}
	
	/**
	 * 分佣
	 */
	public void setCommissions(int value) {
		setCommissions(new Integer(value));
	}
	
	/**
	 * 分佣
	 */
	public void setCommissions(Integer value) {
		this.commissions = value;
	}
	
	/**
	 * 分佣
	 */
	@Column(name="commissions", nullable=true, length=10)	
	public Integer getCommissions() {
		return commissions;
	}
	
	/**
	 * 积分
	 */
	public void setPoints(int value) {
		setPoints(new Integer(value));
	}
	
	/**
	 * 积分
	 */
	public void setPoints(Integer value) {
		this.points = value;
	}
	
	/**
	 * 积分
	 */
	@Column(name="points", nullable=true, length=10)	
	public Integer getPoints() {
		return points;
	}
	
	/**
	 * 账号状态
	 */
	public void setState(byte value) {
		setState(new Byte(value));
	}
	
	/**
	 * 账号状态
	 */
	public void setState(Byte value) {
		this.state = value;
	}
	
	/**
	 * 账号状态
	 */
	@Column(name="state", nullable=true)	
	public Byte getState() {
		return state;
	}
	
	/**
	 * 支付密码
	 */
	public void setPaypwd(String value) {
		this.paypwd = value;
	}
	
	/**
	 * 支付密码
	 */
	@Column(name="paypwd", nullable=true, length=255)	
	public String getPaypwd() {
		return paypwd;
	}
	
	/**
	 * 密码加密
	 */
	public void setKey1(String value) {
		this.key1 = value;
	}
	
	/**
	 * 密码加密
	 */
	@Column(name="key1", nullable=true, length=255)	
	public String getKey1() {
		return key1;
	}
	
	/**
	 * 是否锁定
	 */
	public void setIsLocked(byte value) {
		setIsLocked(new Byte(value));
	}
	
	/**
	 * 是否锁定
	 */
	public void setIsLocked(Byte value) {
		this.isLocked = value;
	}
	
	/**
	 * 是否锁定
	 */
	@Column(name="isLocked", nullable=true)	
	public Byte getIsLocked() {
		return isLocked;
	}
	
	/**
	 * 校验码
	 */
	public void setVerify(String value) {
		this.verify = value;
	}
	
	/**
	 * 校验码
	 */
	@Column(name="verify", nullable=true, length=255)	
	public String getVerify() {
		return verify;
	}
	
	/**
	 * 版本号
	 */
	public void setVersion(int value) {
		setVersion(new Integer(value));
	}
	
	/**
	 * 版本号
	 */
	public void setVersion(Integer value) {
		this.version = value;
	}
	
	/**
	 * 版本号
	 */
	@Column(name="version", nullable=true, length=10)	
	@Version	
	public Integer getVersion() {
		return version;
	}
	
	public void setKey2(String value) {
		this.key2 = value;
	}
	
	@Column(name="key2", nullable=true, length=255)	
	public String getKey2() {
		return key2;
	}
	
	public void setMember(cn.imvc.app.entities.Member value) {
		this.member = value;
	}
	
	@OneToOne(targetEntity=cn.imvc.app.entities.Member.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="memberId", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Member getMember() {
		return member;
	}
	
	public void setFundFlow(java.util.Set value) {
		this.fundFlow = value;
	}
	
	@OneToMany(mappedBy="account", targetEntity=cn.imvc.app.entities.FundFlow.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getFundFlow() {
		return fundFlow;
	}
	
	
	public void setCommission(java.util.Set value) {
		this.commission = value;
	}
	
	@OneToMany(mappedBy="account", targetEntity=cn.imvc.app.entities.Commission.class)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.LOCK})	
	@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.TRUE)	
	public java.util.Set getCommission() {
		return commission;
	}
	
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("Account[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getMember() != null)
				sb.append("Member.Persist_ID=").append(getMember().toString(true)).append(" ");
			else
				sb.append("Member=null ");
			sb.append("Purse=").append(getPurse()).append(" ");
			sb.append("Commissions=").append(getCommissions()).append(" ");
			sb.append("Points=").append(getPoints()).append(" ");
			sb.append("State=").append(getState()).append(" ");
			sb.append("Paypwd=").append(getPaypwd()).append(" ");
			sb.append("Key1=").append(getKey1()).append(" ");
			sb.append("Key2=").append(getKey2()).append(" ");
			sb.append("IsLocked=").append(getIsLocked()).append(" ");
			sb.append("Verify=").append(getVerify()).append(" ");
			sb.append("Version=").append(getVersion()).append(" ");
			sb.append("FundFlow.size=").append(getFundFlow().size()).append(" ");
			sb.append("Commission.size=").append(getCommission().size()).append(" ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
